package com.example.securitydemos.config.authentication;

import org.springframework.security.authentication.AuthenticationDetailsSource;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/**
 * @author linjy on 2023/1/30
 * 基于自定义的认证提供器实现图形验证码
 */
//@Component
public class MyWebAuthenticationDetailsSource implements AuthenticationDetailsSource<HttpServletRequest, WebAuthenticationDetails> {

    /**
     * 创建一个WebAuthenticationDetails对象
     */
    @Override
    public WebAuthenticationDetails buildDetails(HttpServletRequest request) {

        return new MyWebAuthenticationDetails(request);
    }

}
